/*
 * Daniel R Padilla
 *
 * Copyright (c) 2007, Daniel R Padilla
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 */
package org.databasefacade;


import java.util.ArrayList;


public class ConnectionProperties {
    private String dsClass;
    private String metaDataDir;
    private int databaseType;
    private ArrayList methods = new ArrayList();
    private ArrayList parameters = new ArrayList();
	
    public void setDatabaseType(String dbType) {
        databaseType = DatabaseFacade.ANSI_SQL_92;
        if (dbType == null) {
            return;
        }
        if (dbType.equalsIgnoreCase("MYSQL")) {
            databaseType = DatabaseFacade.MYSQL;
        } else if (dbType.equalsIgnoreCase("MSSQL")) {
            databaseType = DatabaseFacade.MSSQL;
        } else if (dbType.endsWith("FIREBIRD")) {
            databaseType = DatabaseFacade.FIREBIRD;
        } else if (dbType.endsWith("ORACLE")) {
            databaseType = DatabaseFacade.ORACLE;
        } else if (dbType.endsWith("INFORMIX")) {
            databaseType = DatabaseFacade.INFORMIX;
        }
    }

    public int getDatabaseType() {
        return databaseType;
    }

    public void setDataSourceClass(String dsClassName) {
        dsClass = dsClassName;
    }

    public String getDataSourceClass() {
        return dsClass;
    }
    
    public void setMetaDataDir(String directory) {
        metaDataDir = directory;
    }

    public String getMetaDataDir() {
        return metaDataDir;
    }


    public int methodListSize() {
        return methods.size();
    }

    public void addMethod(String methodName, String parameter) {
        methods.add(methodName);
        parameters.add(parameter);
    }

    public String getMethodName(int i) {
        return (String) methods.get(i);
    }

    public String getParameter(int i) {
        return (String) parameters.get(i);
    }
}
